<?php require_once('../Connections/agriculture.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_rfmanageRecordset1 = 10;
$pageNum_rfmanageRecordset1 = 0;
if (isset($_GET['pageNum_rfmanageRecordset1'])) {
  $pageNum_rfmanageRecordset1 = $_GET['pageNum_rfmanageRecordset1'];
}
$startRow_rfmanageRecordset1 = $pageNum_rfmanageRecordset1 * $maxRows_rfmanageRecordset1;

mysql_select_db($database_agriculture, $agriculture);
$query_rfmanageRecordset1 = "SELECT * FROM fmanage";
$query_limit_rfmanageRecordset1 = sprintf("%s LIMIT %d, %d", $query_rfmanageRecordset1, $startRow_rfmanageRecordset1, $maxRows_rfmanageRecordset1);
$rfmanageRecordset1 = mysql_query($query_limit_rfmanageRecordset1, $agriculture) or die(mysql_error());
$row_rfmanageRecordset1 = mysql_fetch_assoc($rfmanageRecordset1);

if (isset($_GET['totalRows_rfmanageRecordset1'])) {
  $totalRows_rfmanageRecordset1 = $_GET['totalRows_rfmanageRecordset1'];
} else {
  $all_rfmanageRecordset1 = mysql_query($query_rfmanageRecordset1);
  $totalRows_rfmanageRecordset1 = mysql_num_rows($all_rfmanageRecordset1);
}
$totalPages_rfmanageRecordset1 = ceil($totalRows_rfmanageRecordset1/$maxRows_rfmanageRecordset1)-1;

$queryString_rfmanageRecordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_rfmanageRecordset1") == false && 
        stristr($param, "totalRows_rfmanageRecordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_rfmanageRecordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_rfmanageRecordset1 = sprintf("&totalRows_rfmanageRecordset1=%d%s", $totalRows_rfmanageRecordset1, $queryString_rfmanageRecordset1);
?><div ><a href="stianjian.php">查看信息</a></div>
        <div ><a href="wtianjian.php">录入信息</a></div>
      <div ><a href="drtianjian.php">修改/删除信息</a></div>
      <div ><a href="out.php">退出登陆</a></div>
	  <p><br>
</p>
      <table width="800" height="50" border="1" cellpadding="0" cellspacing="0">
        <tr>
          <td>ID</td>
          <td>名称</td>
          <td>症状</td>
          <td>时间</td>
          <td>处理方法</td>
          <td>操作</td>
        </tr>
        <?php do { ?>
        <tr>
          <td><?php echo $row_rfmanageRecordset1['fmanage_id']; ?></td>
          <td><?php echo $row_rfmanageRecordset1['fmanage_crop']; ?></td>
          <td><?php echo $row_rfmanageRecordset1['fmanage_symptom']; ?></td>
          <td><?php echo $row_rfmanageRecordset1['fmanage_time']; ?></td>
          <td><?php echo $row_rfmanageRecordset1['fmanage_method']; ?></td>
          <td><a href="rtianjian.php?id=<?php echo $row_rfmanageRecordset1['fmanage_id']; ?>">修改</a> 删除</td>
        </tr>
          <?php } while ($row_rfmanageRecordset1 = mysql_fetch_assoc($rfmanageRecordset1)); ?>
      </table>
      <p>
      <table border="0" width="50%">
        <tr>
          <td width="23%" align="center"><?php if ($pageNum_rfmanageRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_rfmanageRecordset1=%d%s", $currentPage, 0, $queryString_rfmanageRecordset1); ?>"></a>第一页
                <?php } // Show if not first page ?>
          </td>
          <td width="31%" align="center"><?php if ($pageNum_rfmanageRecordset1 > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_rfmanageRecordset1=%d%s", $currentPage, max(0, $pageNum_rfmanageRecordset1 - 1), $queryString_rfmanageRecordset1); ?>">上一页</a>
                <?php } // Show if not first page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_rfmanageRecordset1 < $totalPages_rfmanageRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_rfmanageRecordset1=%d%s", $currentPage, min($totalPages_rfmanageRecordset1, $pageNum_rfmanageRecordset1 + 1), $queryString_rfmanageRecordset1); ?>">下一页</a>
                <?php } // Show if not last page ?>
          </td>
          <td width="23%" align="center"><?php if ($pageNum_rfmanageRecordset1 < $totalPages_rfmanageRecordset1) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_rfmanageRecordset1=%d%s", $currentPage, $totalPages_rfmanageRecordset1, $queryString_rfmanageRecordset1); ?>">最后页 </a>
                <?php } // Show if not last page ?>
          </td>
        </tr>
      </table>
      </p>
<p>&nbsp; </p>
      <?php
mysql_free_result($rfmanageRecordset1);
?>
